package com.xjcs.saplingplan.room.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.xjcs.saplingplan.room.bean.countdown.CountdownBean
import kotlinx.coroutines.flow.Flow

@Dao
interface CountdownDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(bean: CountdownBean)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertList(bean: MutableList<CountdownBean>)

    @Query("select * from CountdownBean where countdownUserId = :userId order by createTimeMillis")
    fun getAllCountdownList(userId: String): MutableList<CountdownBean>

    @Query("select * from CountdownBean where countdownUserId = :userId and countdownCateName = :countdownCateName order by createTimeMillis")
    fun getAllCountdownListByCate(userId: String, countdownCateName: String): MutableList<CountdownBean>

}